clear
set more off
cap log cl

// This file extracts CBP data using codes from Autor-Dorn (http://www.ddorn.net/data.htm)
// and merges with establishment counts from:
// https://www.fpeckert.me/cbp/

	
// Run
	// 1- extraction from raw
	// 2- Autor-Dorn imputations for missing
	
// Get establishment counts by county x industry (native)	
forval y = 75/97 { 
	do  "${cbp}/CPB_SIC_estab.do" `y'
}

foreach y in  98 99 00 01 02 03 04 05 06 07 08 09 10 {
		do  "${cbp}/CPB_NAICS_estab.do" `y' 
}


// Get employment from efsy
// merge it with estab counts
do "$cbp/estab_emp_merge.do"


// Aggregate industries
do "$cbp/cbp_countyid_sic87.do"

